package com.googlecode.alogwe.sprockit.unused;

import java.util.Vector;

public class SynchronizedBuffer<T> {
	
	private Vector<T>	v;

	public SynchronizedBuffer() {
		v = new Vector<T>();
	}

	public boolean isEmpty() {
		return v.isEmpty();
	}

	public synchronized void push(T a) {
		try {
			v.add(a);
		} finally {
			this.notifyAll();
		}
	}

	public synchronized T pull() {
		try {
			T result = null;
			result = v.remove(0);
			return result;
		} finally {
			this.notifyAll();
		}
	}

}